package com.hutu.controller.biz.admin.system;

import com.hutu.entity.system.Staff;
import com.hutu.model.resp.ResponseVo;
import com.hutu.service.system.LoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 登录注册接口
 *
 * @Author : admin
 * @Date : 2022/1/30
 */
@RestController
@Api(tags = "登录注册")
public class LoginController {

    @Resource
    private LoginService loginService;

    @PostMapping("/admin/login")
    @ApiOperation("登录")
    public ResponseVo login(@RequestBody Staff staff) {
        return this.loginService.login(staff);
    }

    /**
     * 通过账号查找后台用户
     * @param code
     * @return
     */
    @GetMapping("/admin/find")
    @ApiOperation("通过账号查找后台用户是否存在")
    public ResponseVo findByCode(@ApiParam("后台用户ID") String code){
        return this.loginService.findByCode(code);
    }


}
